The Tab View Component >Events > onSelect() |
FTabView : Event : onSelect()
Availability
Flash Player 6.
Usage
myTabListener.onSelect = function( oldIndex,
newIndex, tbv) { ... }
Parameters
oldIndex A number indicating the index of the previously selected
tab.
newIndex A number indicating the index of the newly selected
tab.
tbv A reference to the component which triggered
the event.
Returns
Nothing
Description
This event is triggered by the component whenever a new item is selected by the user or with the setSelectedIndex method. Once it is triggered, it is broadcast to all listeners. Listeners may subscribe to listen for the onSelect event with the addListener method.
Example
The tab_addListener.fla example file contains an example of using this method.
The following example adds listeners to the component to listen for the onSelect event.
// make the grid and form listen for the onSelect event
myTab_tbv.addListener(myGrid_dg);
myTab_tbv.addListener(myForm_mc);
// define handlers for the onSelect event
myGrid_dg.onSelect = function(oldIndex, newIndex, tbv)
{
// set visible=true if the label is "grid". otherwise false
var item = myTab_tbv.getItemAt(newIndex); this._visible = (item.label == "grid");
}
myForm_mc.onSelect = function(oldIndex, newIndex, tbv)
{
// set visible=true if the label is "form". otherwise false
var item = myTab_tbv.getItemAt(newIndex); this._visible = (item.label == "form");
}
See also